'''
@Project ：my_python_project 
@File    ：作业5.py
@IDE     ：PyCharm 
@Author  ：xionglinhui
@Date    ：2024/6/13 上午9:36 
'''
#5. 求1-2+3-4+5 ... 99的所有数的和.

# print(pow(-1,3))

sum = 0
count = 1

while count <=99:
    i = pow(-1,count+1)*count
    print(i, end=' ')
    sum = sum + i
    count += 1

print()  # 换行
print('sum=', sum)